package com.blog.security.service;

import com.blog.security.entity.AuthUserDetails;
import com.blog.security.mapper.HrMapper;
import com.blog.security.mapper.MenuMapper;
import com.blog.security.entity.Menu;
import com.blog.system.Hr;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName BaseMenuService
 * @Destription
 * @Author 天堂小野花
 * @Date 2025/6/22  13:41
 * @Version 1.0
 */
@Service
public class BaseMenuService {
    @Autowired
    MenuMapper menuMapper;
    @Autowired
    HrMapper hrMapper;
    @Autowired
    PasswordEncoder passwordEncoder;
    public List<Menu> getMenuByHrId(Integer hrid ){
        return menuMapper.getMenuByHrId(hrid);
    }
    public int addUsers(Hr hr) {
        String encoder = passwordEncoder.encode(hr.getPassword());
        hr.setPassword(encoder);
        return hrMapper.insert(hr);
    }
}
